<meta content="text/html; charset=UTF-8; X-Content-Type-Options=nosniff" http-equiv="Content-Type" />
<div id="wp_ifram_pop_win">
	<div id="wp_ifram_pop_content" >
		<iframe id="wp_iframe_pop_win_ifram"  frameborder="0"  src=""></iframe>
	</div>
</div>

<script type="text/javascript">
var wp_iframe_win = (function() {
	var win;
	$('#wp_ifram_pop_win').hide();

	return {

		openIframWindow:function(url,title){
			var iwantto_app_detail_win = $('#wp_ifram_pop_win');
			iwantto_app_detail_win.kendoWindow({
					title:"Window",
					visible:false,
					resizable: false,
					draggable: false,
					modal: true,
					actions:["Close"],
					close:function(){
						$("#wp_ifram_pop_content").empty();
						$("#wp_ifram_pop_content").append("<iframe id='wp_iframe_pop_win_ifram'  frameborder='0'></iframe>");
					}
					
			});
			// if(title=="Create an app"){
			// 	url="http://192.168.3.102:8080/workportui/width50.html";
			// }else{
			// 	url="http://192.168.3.102:8080/workportui/width200.html";
			// }
    		$("#wp_iframe_pop_win_ifram").attr("src",url);
	        document.getElementById('wp_iframe_pop_win_ifram').onload = function() {
	        	try{ 
	        		iwantto_app_detail_win.data("kendoWindow").open();
		        	var w = document.getElementById('wp_iframe_pop_win_ifram').contentWindow.document.body.scrollWidth;
		        	var h = document.getElementById('wp_iframe_pop_win_ifram').contentWindow.document.body.scrollHeight;
		        	var screenWidth = $(window).width();
		        	if(w>(screenWidth*0.9)){
		        		w=screenWidth*0.9;
		        	}
		        	if(h>(Screen.bodyHeight*0.9)){
		        		h=Screen.bodyHeight*0.9;
		        	}
		        	$("#wp_iframe_pop_win_ifram").width(w + 20);
		        	$("#wp_iframe_pop_win_ifram").height(h + 20);
		        	iwantto_app_detail_win.data("kendoWindow").center();
			    }catch(e){
			       var screenWidth = $(window).width();
		    	   w=screenWidth*0.9;
		    	   h=Screen.bodyHeight*0.9;
		    	   $("#wp_iframe_pop_win_ifram").width(w + 20);
		           $("#wp_iframe_pop_win_ifram").height(h + 20);
			       iwantto_app_detail_win.data("kendoWindow").center();
			       Workport.utils.alertMsg("Error",e.message,function(_data){});
			    }
	        };
			if(title&&title!=""){
				iwantto_app_detail_win.data("kendoWindow").title(title);
			}
			win=iwantto_app_detail_win;
		},
		closeWin:function(){
			if(win){
				win.data("kendoWindow").close();
			}
		}
	};

})();

function closeIWTWindow(){
	wp_iframe_win.closeWin();
}
</script>